luci-app-snmpd: require 8 character password
authorChristian Korber <[email protected]>
Mon, 19 May 2025 11:00:22 +0000 (13:00 +0200)
committerPaul Donald <[email protected]>
Wed, 3 Sep 2025 18:55:05 +0000 (20:55 +0200)
Test for required length of passphrases according to net-snmp

Signed-off-by: Christian Korber <[email protected]>
applications/luci-app-snmpd/htdocs/luci-static/resources/view/snmpd/snmpd.js

index a2b5300a8f338f31fcfa3aa5e9429573faec8b39..6e2e1cad1a45b27784e1cb6ff8785883cc86c246 100644 (file)
@@ -27,6 +27,13 @@ return L.view.extend({
                this.snmp_version = null;
        },
 
+       testPassLength: function(section_id, value) {
+                       if (value.length < 8)
+                               return _('Password must be at least 8 characters');
+
+                       return true;
+               },
+
        populateSystemSettings: function(tab, s) {
                let g, go, o;
 
@@ -320,6 +327,7 @@ return L.view.extend({
                go.rmempty = true;
                go.modalonly = true;
                go.optional = false;
+               go.validate = this.testPassLength;
                go.depends({'auth_type': '', '!reverse': true});
 
                // SNMPv3 privacy/encryption type
@@ -338,6 +346,7 @@ return L.view.extend({
                go.rmempty = true;
                go.modalonly = true;
                go.optional = false;
+               go.validate = this.testPassLength;
                go.depends({'privacy_type': '', '!reverse': true});
 
                go = g.option(form.ListValue, 'RestrictOID',